﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using XCode.DataAccessLayer;

/// <summary>
///管理页基类
/// </summary>
public class AdminBase : System.Web.UI.Page
{
    public AdminBase()
    {
        //
        //TODO: 在此处添加构造函数逻辑
        //
    }

    protected override void OnLoad(EventArgs e)
    {
        if (!XCMSData.User.IsLogined) Response.Redirect("../Login.aspx");

        base.OnLoad(e);
    }

    DateTime Start = DateTime.Now;

    protected override void Render(HtmlTextWriter writer)
    {
        base.Render(writer);

        //TimeSpan ts = DateTime.Now - Start;
        //writer.WriteLine("<div style=\"clear:both; margin: 0 auto; width: 100%\">页面执行时间：<font color=\"red\">{0}ms</font>，缓存个数：<font color=\"red\">{1}</font>，查询<font color=\"red\">{2}</font>次，执行<font color=\"red\">{3}</font>次</div>", ts.TotalMilliseconds, DAL.Default.CacheCount, DAL.Default.QueryTimes, DAL.Default.ExecuteTimes);
    }
}